﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Simple.Repository.Migrations
{
    public partial class _55 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "PrincipalHotline",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    ChildId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "幼儿id", collation: "ascii_general_ci"),
                    ClassId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "班级", collation: "ascii_general_ci"),
                    ParentId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "家长id", collation: "ascii_general_ci"),
                    Relationship = table.Column<int>(type: "int", nullable: true, comment: "家属关系"),
                    IsReply = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "是否回复"),
                    Content = table.Column<string>(type: "longtext", nullable: true, comment: "内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "软删标记"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "创建时间"),
                    CreatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "创建用户Id", collation: "ascii_general_ci"),
                    UpdatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "更新时间"),
                    UpdatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "更新用户Id", collation: "ascii_general_ci"),
                    OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "机构Id", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PrincipalHotline", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PrincipalHotlineImage",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    FiledId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "文件Id", collation: "ascii_general_ci"),
                    FileName = table.Column<string>(type: "longtext", nullable: false, comment: "文件名称")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    FileSize = table.Column<string>(type: "longtext", nullable: false, comment: "文件大小")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PrincipalHotlineId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "院长热线id", collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "软删标记"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "创建时间"),
                    CreatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "创建用户Id", collation: "ascii_general_ci"),
                    UpdatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "更新时间"),
                    UpdatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "更新用户Id", collation: "ascii_general_ci"),
                    OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "机构Id", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PrincipalHotlineImage", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PrincipalHotlineImage_PrincipalHotline_PrincipalHotlineId",
                        column: x => x.PrincipalHotlineId,
                        principalTable: "PrincipalHotline",
                        principalColumn: "Id");
                },
                comment: "园长热线图片表")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateTable(
                name: "PrincipalHotlineReply",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "主键", collation: "ascii_general_ci"),
                    ReplyUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "回复人id", collation: "ascii_general_ci"),
                    ReplyUserName = table.Column<string>(type: "longtext", nullable: true, comment: "回复人名")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReplyContent = table.Column<string>(type: "longtext", nullable: true, comment: "回复内容")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    PrincipalHotlineId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "院长热线id", collation: "ascii_general_ci"),
                    IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false, comment: "软删标记"),
                    CreatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "创建时间"),
                    CreatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "创建用户Id", collation: "ascii_general_ci"),
                    UpdatedTime = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "更新时间"),
                    UpdatedUserId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "更新用户Id", collation: "ascii_general_ci"),
                    OrganizationId = table.Column<Guid>(type: "char(36)", nullable: true, comment: "机构Id", collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_PrincipalHotlineReply", x => x.Id);
                    table.ForeignKey(
                        name: "FK_PrincipalHotlineReply_PrincipalHotline_PrincipalHotlineId",
                        column: x => x.PrincipalHotlineId,
                        principalTable: "PrincipalHotline",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_PrincipalHotlineImage_PrincipalHotlineId",
                table: "PrincipalHotlineImage",
                column: "PrincipalHotlineId");

            migrationBuilder.CreateIndex(
                name: "IX_PrincipalHotlineReply_PrincipalHotlineId",
                table: "PrincipalHotlineReply",
                column: "PrincipalHotlineId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "PrincipalHotlineImage");

            migrationBuilder.DropTable(
                name: "PrincipalHotlineReply");

            migrationBuilder.DropTable(
                name: "PrincipalHotline");
        }
    }
}
